package zhjb.platform.module.schedule.bean;

import java.util.HashSet;
import java.util.Set;

public class MDate {
	/** 年 */
	private int year;
	/** 月 */
	private int month;
	/** 日 */
	private int date;
	/** 星期 */
	private int day;
	/** 是否是当前日期 */
	private boolean curDate;
	/** 任务数量 */
	private Set<ScheduleTask> tasks;

	public int getYear() {
		return year;
	}

	public void setYear(int year) {
		this.year = year;
	}

	public int getMonth() {
		return month;
	}

	public void setMonth(int month) {
		this.month = month;
	}

	public int getDate() {
		return date;
	}

	public void setDate(int date) {
		this.date = date;
	}

	public int getDay() {
		return day;
	}

	public void setDay(int day) {
		this.day = day;
	}

	public boolean isCurDate() {
		return curDate;
	}

	public void setCurDate(boolean curDate) {
		this.curDate = curDate;
	}

	public Set<ScheduleTask> getTasks() {
		if (tasks == null) {
			tasks = new HashSet<ScheduleTask>();
		}
		return tasks;
	}

	public String taskIds() {
		StringBuilder sbInf = new StringBuilder();
		Set<ScheduleTask> tasks = getTasks();
		for (ScheduleTask t : tasks) {
			if (sbInf.length() > 0) {
				sbInf.append(',');
			}
			sbInf.append(t.getId());
		}
		return sbInf.toString();
	}

	public void setTasks(Set<ScheduleTask> tasks) {
		this.tasks = tasks;
	}
}
